﻿module Int32_TryParse

open System

//编译器在对有ref 和out 的参数的方法是比较智能
//out 参数在最后的时候，可以不传 ，会以tuple 形式返回

let i  =ref 1
let x =Int32.TryParse("asdf",i)

//val i : int ref = {contents = 0;}
//val x : bool = false


let x2 =Int32.TryParse("321")

//val x2 : bool * int = (false, 0)


//f# 不区分ref  out  差别
//#r @"C:\Users\Administrator\Desktop\Test\FSharpYard\FSharpYard\ClassLibrary1\bin\Debug\csharp.dll"
open csharp
let o = new ref_out_parameters_fsharpBehavior()

let i5 =ref 0
let x5 =o.TryParse("1",i5) // ref 的参数不能少

let i6 =ref 0
let x6 =o.TryParse2("1j")

let i2 =ref 0
let x3 =o.TryParse_(i2,"1") //不可不写i2 

let i3 =ref 0
let x4 =o.TryParse2_(i3,"1j")